package club.cearnach.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import java.util.Date;

/**
 * @author 阮胜
 * @date 2018/5/24 13:57
 */
@Data
@Entity
@DynamicUpdate
@DynamicInsert
public class UserFavorite {
    @EmbeddedId
    private UserMovieId userMovieId;

    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
    private Date updateDate;
    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", updatable = false)
    private Date createDate;

    public UserFavorite() {
    }

    public UserFavorite(UserMovieId userMovieId) {
        this.userMovieId = userMovieId;
    }
}
